﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace WSSGServer
{
    public class StarObject
    {
        #region Fields
        private string m_Name;
        private int m_Id;
        private string m_dir;
        private float m_X;
        private float m_Y;
        private float m_Z;
        private float m_R;
        private float m_W;
        private float m_RSpeed;
        private float m_OSpeed;
        private float m_AngleX;
        private float m_AngleZ;
        private float m_AngleY;
        private StarObject m_OrbitObj;
        private float m_nX;
        private float m_nY;
        private float m_nZ;
        private List<DataObject> m_StarObjects;
        #endregion
        private Vector3 m_CurrentPosition;
        private float m_DirectRotationOrbit;
        private float m_Angle;
        #region Propertes 
        public List<DataObject> StarObjects
        {
            get { return m_StarObjects; }
            set { m_StarObjects = value; }
        }
        public StarObject OrbitObj
        {
            get { return m_OrbitObj; }
            set { m_OrbitObj = value; }
        }
        public float W
        {
            get { return m_W; }
            set { m_W = value; }
        }
        public float RadSpeed
        {
            get { return m_RSpeed; }
            set { m_RSpeed = value; }
        }
        public float OrbitSpeed
        {
            get { return m_OSpeed; }
            set { m_OSpeed = value; }
        }
        public float AngleX
        {
            get { return m_AngleX; }
            set { m_AngleX = value; }
        }
        public float AngleY
        {
            get { return m_AngleY; }
            set { m_AngleY = value; }
        }
        public float AngleZ
        {
            get { return m_AngleZ; }
            set { m_AngleZ = value; }
        }        
        public float R
        {
            get { return m_R; }
            set { m_R = value; }
        }
        public float Z
        {
            get { return m_Z; }
            set { m_Z = value; }
        }
        public float Y
        {
            get { return m_Y; }
            set { m_Y = value; }
        }
        public float X
        {
            get { return m_X; }
            set { m_X = value; }
        }
        public float NZ
        {
            get { return m_nZ; }
            set { m_nZ = value; }
        }
        public float NY
        {
            get { return m_nY; }
            set { m_nY = value; }
        }
        public float NX
        {
            get { return m_nX; }
            set { m_nX = value; }
        }
        public int ID
        {
            get { return m_Id; }
            set { m_Id = value; }
        }
        public string Dirictory
        {
            get { return m_dir; }
            set { m_dir = value; }
        }
        public string Name
        {
            get { return m_Name; }
            set { m_Name = value; }
        }
        #endregion
        #region Methods
        /// <summary>
        /// Конструктор космического объекта
        /// </summary>
        /// <param name="name">Имя</param>
        /// <param name="dir">Папка</param>
        /// <param name="x">позиция Х</param>
        /// <param name="y">позиция Y</param>
        /// <param name="z">позиция Z</param>
        /// <param name="r">Радиус</param>
        /// <param name="w">Вес</param>
        /// <param name="nx">позиция Х точки вокруг которой вращается</param>
        /// <param name="ny">позиция Y точки вокруг которой вращается</param>
        /// <param name="nz">позиция Z точки вокруг которой вращается</param>
        /// <param name="rs">Скорость вращение вокруг оси</param>
        /// <param name="os">Скорость вращение вокруг точки вращение орбита</param>
        /// <param name="angX">угол наклона оси X</param>
        /// <param name="angX">угол наклона оси Y</param>
        /// <param name="angX">угол наклона оси Z</param>
        public StarObject(string Name, string dir, float x, float y, float z, float r, float w
            , float nx, float ny, float nz, float rs, float os, float angX, float angY, float angZ, StarObject orbitObj
            )
        {
            m_Name = Name;
            m_dir = dir;
            m_R = r;
            m_W = w;
            m_X = x;
            m_Y = y;
            m_Z = z;
            m_RSpeed = rs;
            m_OSpeed = os;
            m_AngleX = angX;
            m_AngleY = angY;
            m_AngleZ = angZ;
            m_nX = nx;
            m_nY = ny;
            m_nZ = nz;
            m_OrbitObj=orbitObj;
        }
        public StarObject()
        {

        }
        public void Load()
        {
        }
        public void Save()
        {
            DirectoryInfo DIR = new DirectoryInfo(m_dir);
            if (!DIR.Exists)
            {
                DIR.Create();
            }
        }
        public void Do()
        {
           


	

i=0;
for (alpha = -90; alpha<=90; alpha+=20)
  for (beta = 0; beta<360; beta+=20)
  {
   x[i] =   R * cos (PI * alpha/180.0) * sin (PI * beta/180.0);
   y[i] =   R * cos (PI * alpha/180.0) * cos (PI * beta/180.0);
   z[i] = 2*R * sin (alpha);
   i++;
  }
        
        }
        #endregion
    }
}
